#include "ringQueue.hpp"

void *Consumer(void *args)
{
    RingQueue<int> *rq = (RingQueue<int> *)args;
    while (true)
    {
        int x;
        rq->pop(&x);
        std::cout << "消费：" << x << std::endl;
    }
    return nullptr;
}
void *Productor(void *args)
{
    RingQueue<int> *rq = (RingQueue<int> *)args;
    while (true)
    {
        int x = 10;
        std::cout << "生产：" << x << std::endl;
        rq->push(x);
    }
    return nullptr;
}

int main()
{
    RingQueue<int> *rq = new RingQueue<int>(10);
    rq->debug();
    pthread_t c, p;
    pthread_create(&c, nullptr, Consumer, (void *)rq);
    pthread_create(&c, nullptr, Productor, (void *)rq);
    pthread_join(c, nullptr);
    pthread_join(p, nullptr);
    return 0;
}